package Level02_three;

public class ZooManager {
    private String name;
    private int age;
    void feed(Animal a){
        if (a instanceof Tiger){
            System.out.println(getAge()+"岁的"+getName()+"会给"+a.getColor()+"的"+a.getAge()+"岁老虎喂食");
        }else if (a instanceof Parrot){
            System.out.println(getAge()+"岁的"+getName()+"会给"+a.getColor()+"的"+a.getAge()+"岁鹦鹉喂食");
        }else if (a instanceof Gorilla){
            System.out.println(getAge()+"岁的"+getName()+"会给"+a.getColor()+"的"+a.getAge()+"岁猩猩喂食");
        }
    }
    void letItShow(Actor a){
        //如果是鹦鹉,把 a 向下转型为 Parrot 类型,调用说话方法
        //如果是Parrot或者ActedParrot调用
        if (a instanceof Parrot){
            Parrot p = (Parrot) a;
            ((Parrot) a).say();
        }else {
            a.play();
        }

    }

    public ZooManager(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
